3.2.70 \(\int (a+b \sec (c+d x)) \sin ^2(c+d x) \, dx\) [170]

Optimal. Leaf size=51 \[ \frac {a x}{2}+\frac {b \tanh ^{-1}(\sin (c+d x))}{d}-\frac {b \sin (c+d x)}{d}-\frac {a \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*a*x+b*arctanh(sin(d*x+c))/d-b*sin(d*x+c)/d-1/2*a*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.368, Rules used = {3957, 2917, 2672, 327, 212, 2715, 8} \begin {gather*} -\frac {a \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a x}{2}-\frac {b \sin (c+d x)}{d}+\frac {b \tanh ^{-1}(\sin (c+d x))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*Sec[c + d*x])*Sin[c + d*x]^2,x]

[Out]

(a*x)/2 + (b*ArcTanh[Sin[c + d*x]])/d - (b*Sin[c + d*x])/d - (a*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rule 3957

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Co
s[e + f*x])^p*((b + a*Sin[e + f*x])^m/Sin[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]

Rubi steps

\begin {align*} \int (a+b \sec (c+d x)) \sin ^2(c+d x) \, dx &=-\int (-b-a \cos (c+d x)) \sin (c+d x) \tan (c+d x) \, dx\\ &=a \int \sin ^2(c+d x) \, dx+b \int \sin (c+d x) \tan (c+d x) \, dx\\ &=-\frac {a \cos (c+d x) \sin (c+d x)}{2 d}+\frac {1}{2} a \int 1 \, dx+\frac {b \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {a x}{2}-\frac {b \sin (c+d x)}{d}-\frac {a \cos (c+d x) \sin (c+d x)}{2 d}+\frac {b \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {a x}{2}+\frac {b \tanh ^{-1}(\sin (c+d x))}{d}-\frac {b \sin (c+d x)}{d}-\frac {a \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.05, size = 54, normalized size = 1.06 \begin {gather*} \frac {a (c+d x)}{2 d}+\frac {b \tanh ^{-1}(\sin (c+d x))}{d}-\frac {b \sin (c+d x)}{d}-\frac {a \sin (2 (c+d x))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sec[c + d*x])*Sin[c + d*x]^2,x]

[Out]

(a*(c + d*x))/(2*d) + (b*ArcTanh[Sin[c + d*x]])/d - (b*Sin[c + d*x])/d - (a*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.07, size = 55, normalized size = 1.08

method result size
derivativedivides \(\frac {b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(55\)
default \(\frac {b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(55\)
risch \(\frac {a x}{2}+\frac {i b \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}-\frac {i b \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {a \sin \left (2 d x +2 c \right )}{4 d}\) \(90\)
norman \(\frac {a x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (a -2 b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a x}{2}+\frac {a x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {\left (a +2 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(126\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sec(d*x+c))*sin(d*x+c)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(b*(-sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+a*(-1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 59, normalized size = 1.16 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a + 2 \, b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )}}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*sin(d*x+c)^2,x, algorithm="maxima")

[Out]

1/4*((2*d*x + 2*c - sin(2*d*x + 2*c))*a + 2*b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c))
)/d

________________________________________________________________________________________

Fricas [A]
time = 3.13, size = 55, normalized size = 1.08 \begin {gather*} \frac {a d x + b \log \left (\sin \left (d x + c\right ) + 1\right ) - b \log \left (-\sin \left (d x + c\right ) + 1\right ) - {\left (a \cos \left (d x + c\right ) + 2 \, b\right )} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*sin(d*x+c)^2,x, algorithm="fricas")

[Out]

1/2*(a*d*x + b*log(sin(d*x + c) + 1) - b*log(-sin(d*x + c) + 1) - (a*cos(d*x + c) + 2*b)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (c + d x \right )}\right ) \sin ^{2}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*sin(d*x+c)**2,x)

[Out]

Integral((a + b*sec(c + d*x))*sin(c + d*x)**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 114 vs. \(2 (47) = 94\).
time = 0.48, size = 114, normalized size = 2.24 \begin {gather*} \frac {{\left (d x + c\right )} a + 2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(d*x+c))*sin(d*x+c)^2,x, algorithm="giac")

[Out]

1/2*((d*x + c)*a + 2*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 2*b*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + 2*(a*tan(
1/2*d*x + 1/2*c)^3 - 2*b*tan(1/2*d*x + 1/2*c)^3 - a*tan(1/2*d*x + 1/2*c) - 2*b*tan(1/2*d*x + 1/2*c))/(tan(1/2*
d*x + 1/2*c)^2 + 1)^2)/d

________________________________________________________________________________________

Mupad [B]
time = 1.09, size = 83, normalized size = 1.63 \begin {gather*} \frac {a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}-\frac {b\,\sin \left (c+d\,x\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(c + d*x)^2*(a + b/cos(c + d*x)),x)

[Out]

(a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*b*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (a*
sin(2*c + 2*d*x))/(4*d) - (b*sin(c + d*x))/d

________________________________________________________________________________________